package cn.template.serve_project.controller;


import cn.template.serve_project.aop.note.Authentication;
import cn.template.serve_project.enums.RoleEnum;
import cn.template.serve_project.result.Result;
import cn.template.serve_project.service.RoleService;
import cn.template.serve_project.vo.role.RoleVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 角色(Role)表控制层
 */
@RestController
@RequestMapping("/role")
public class RoleController {
    /**
     * 服务对象
     */
    @Resource
    private RoleService roleService;

    /**
     * 获取所有的角色
     *
     * @return 角色列表
     */
    @Authentication(role = RoleEnum.ADMIN)
    @GetMapping("/auth/all")
    public Result<List<RoleVO>> selectAll() {
        return Result.success(roleService.selectAll());
    }

}

